package exam.driver.jdbc;

public class StatementSql {
	// luu giu cau truy van
	protected StringBuffer sqlString;
	
	/**
	 * constructor
	 */
	public StatementSql() {
		this.sqlString = new StringBuffer();
	}
	
	/**
	 * select
	 */
	public StatementSql select() {
		this.sqlString.append("SELECT").append(" * ");
		return this;
	}
	/**
	 * delete
	 * @return StatementSql
	 */
	public StatementSql delete() {
		this.sqlString.append("DELETE").append(" ");
		return this;
	}
	/**
	 * from
	 */
	public StatementSql from(String tableName) {
		this.sqlString.append("FROM").append(" ").append(tableName).append(" ");
		return this;
	}
	
	/**
	 * where
	 * @param whereComplex
	 * @return
	 */
	public StatementSql where(WhereComplex whereComplex) {
		this.sqlString.append("WHERE").append(" ").append(whereComplex.toString());
		return this;
	}
	
	/* (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		return this.sqlString.toString();
	}
}
